package com.ppt.javappt.em;

/**
 * 图片资源路径枚举类
 * 统一管理项目中所有图片资源的路径，避免硬编码
 * @author cys
 */
public enum IconPathEnum {

    NEW_FILE("/com/ppt/javappt/icon/新建.png"),
    OPEN_FILE("/com/ppt/javappt/icon/打开文件夹.png"),
    SAVE_FILE("/com/ppt/javappt/icon/保存.png"),
    INSERT_PICTURE("/com/ppt/javappt/icon/图片.png"),
    CURSOR("/com/ppt/javappt/icon/cursor.png"),
    PPT("/com/ppt/javappt/icon/ppt.png");

    // 图片资源路径
    private final String path;

    IconPathEnum(String path) {
        this.path = path;
    }

    public String getPath() {
        return path;
    }

    /**
     * 获取图片资源的URL字符串（用于JavaFX加载）
     * @return 可直接用于ImageView的URL字符串
     */
    public String getUrl() {
        // 确保路径正确拼接，避免空指针
        return getClass().getResource(path) != null
                ? getClass().getResource(path).toExternalForm()
                : null;
    }
}